<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>C语言图书管理系统 | heit0ng</title><meta name="author" content="heit0ng"><meta name="copyright" content="heit0ng"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="学校课程的工程实践简单用C语言写了一下，传上来了，是个图书管理系统 简单做个记录 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384">
<meta property="og:type" content="article">
<meta property="og:title" content="C语言图书管理系统">
<meta property="og:url" content="https://heit0ng.gitee.io/2022/05/16/C%E8%AF%AD%E8%A8%80%E5%9B%BE%E4%B9%A6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/index.html">
<meta property="og:site_name" content="heit0ng">
<meta property="og:description" content="学校课程的工程实践简单用C语言写了一下，传上来了，是个图书管理系统 简单做个记录 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://s2.loli.net/2022/05/16/ae4E7n2D3I5mqkh.jpg">
<meta property="article:published_time" content="2022-05-16T14:28:31.730Z">
<meta property="article:modified_time" content="2022-05-16T14:28:11.642Z">
<meta property="article:author" content="heit0ng">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://s2.loli.net/2022/05/16/ae4E7n2D3I5mqkh.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://heit0ng.gitee.io/2022/05/16/C%E8%AF%AD%E8%A8%80%E5%9B%BE%E4%B9%A6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'C语言图书管理系统',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2022-05-16 22:28:11'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://s2.loli.net/2022/01/28/RkXzVpjubg3yGEI.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">11</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div></div><hr/></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://s2.loli.net/2022/05/16/ae4E7n2D3I5mqkh.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">heit0ng</a></span><div id="menus"><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">C语言图书管理系统</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-05-16T14:28:31.730Z" title="发表于 2022-05-16 22:28:31">2022-05-16</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-05-16T14:28:11.642Z" title="更新于 2022-05-16 22:28:11">2022-05-16</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="C语言图书管理系统"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p>学校课程的工程实践简单用C语言写了一下，传上来了，是个图书管理系统</p>
<p>简单做个记录</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br><span class="line">371</span><br><span class="line">372</span><br><span class="line">373</span><br><span class="line">374</span><br><span class="line">375</span><br><span class="line">376</span><br><span class="line">377</span><br><span class="line">378</span><br><span class="line">379</span><br><span class="line">380</span><br><span class="line">381</span><br><span class="line">382</span><br><span class="line">383</span><br><span class="line">384</span><br><span class="line">385</span><br><span class="line">386</span><br><span class="line">387</span><br><span class="line">388</span><br><span class="line">389</span><br><span class="line">390</span><br><span class="line">391</span><br><span class="line">392</span><br><span class="line">393</span><br><span class="line">394</span><br><span class="line">395</span><br><span class="line">396</span><br><span class="line">397</span><br><span class="line">398</span><br><span class="line">399</span><br><span class="line">400</span><br><span class="line">401</span><br><span class="line">402</span><br><span class="line">403</span><br><span class="line">404</span><br><span class="line">405</span><br><span class="line">406</span><br><span class="line">407</span><br><span class="line">408</span><br><span class="line">409</span><br><span class="line">410</span><br><span class="line">411</span><br><span class="line">412</span><br><span class="line">413</span><br><span class="line">414</span><br><span class="line">415</span><br><span class="line">416</span><br><span class="line">417</span><br><span class="line">418</span><br><span class="line">419</span><br><span class="line">420</span><br><span class="line">421</span><br><span class="line">422</span><br><span class="line">423</span><br><span class="line">424</span><br><span class="line">425</span><br><span class="line">426</span><br><span class="line">427</span><br><span class="line">428</span><br><span class="line">429</span><br><span class="line">430</span><br><span class="line">431</span><br><span class="line">432</span><br><span class="line">433</span><br><span class="line">434</span><br><span class="line">435</span><br><span class="line">436</span><br><span class="line">437</span><br><span class="line">438</span><br><span class="line">439</span><br><span class="line">440</span><br><span class="line">441</span><br><span class="line">442</span><br><span class="line">443</span><br><span class="line">444</span><br><span class="line">445</span><br><span class="line">446</span><br><span class="line">447</span><br><span class="line">448</span><br><span class="line">449</span><br><span class="line">450</span><br><span class="line">451</span><br><span class="line">452</span><br><span class="line">453</span><br><span class="line">454</span><br><span class="line">455</span><br><span class="line">456</span><br><span class="line">457</span><br><span class="line">458</span><br><span class="line">459</span><br><span class="line">460</span><br><span class="line">461</span><br><span class="line">462</span><br><span class="line">463</span><br><span class="line">464</span><br><span class="line">465</span><br><span class="line">466</span><br><span class="line">467</span><br><span class="line">468</span><br><span class="line">469</span><br><span class="line">470</span><br><span class="line">471</span><br><span class="line">472</span><br><span class="line">473</span><br><span class="line">474</span><br><span class="line">475</span><br><span class="line">476</span><br><span class="line">477</span><br><span class="line">478</span><br><span class="line">479</span><br><span class="line">480</span><br><span class="line">481</span><br><span class="line">482</span><br><span class="line">483</span><br><span class="line">484</span><br><span class="line">485</span><br><span class="line">486</span><br><span class="line">487</span><br><span class="line">488</span><br><span class="line">489</span><br><span class="line">490</span><br><span class="line">491</span><br><span class="line">492</span><br><span class="line">493</span><br><span class="line">494</span><br><span class="line">495</span><br><span class="line">496</span><br><span class="line">497</span><br><span class="line">498</span><br><span class="line">499</span><br><span class="line">500</span><br><span class="line">501</span><br><span class="line">502</span><br><span class="line">503</span><br><span class="line">504</span><br><span class="line">505</span><br><span class="line">506</span><br><span class="line">507</span><br><span class="line">508</span><br><span class="line">509</span><br><span class="line">510</span><br><span class="line">511</span><br><span class="line">512</span><br><span class="line">513</span><br><span class="line">514</span><br><span class="line">515</span><br><span class="line">516</span><br><span class="line">517</span><br><span class="line">518</span><br><span class="line">519</span><br><span class="line">520</span><br><span class="line">521</span><br><span class="line">522</span><br><span class="line">523</span><br><span class="line">524</span><br><span class="line">525</span><br><span class="line">526</span><br><span class="line">527</span><br><span class="line">528</span><br><span class="line">529</span><br><span class="line">530</span><br><span class="line">531</span><br><span class="line">532</span><br><span class="line">533</span><br><span class="line">534</span><br><span class="line">535</span><br><span class="line">536</span><br><span class="line">537</span><br><span class="line">538</span><br><span class="line">539</span><br><span class="line">540</span><br><span class="line">541</span><br><span class="line">542</span><br><span class="line">543</span><br><span class="line">544</span><br><span class="line">545</span><br><span class="line">546</span><br><span class="line">547</span><br><span class="line">548</span><br><span class="line">549</span><br><span class="line">550</span><br><span class="line">551</span><br><span class="line">552</span><br><span class="line">553</span><br><span class="line">554</span><br><span class="line">555</span><br><span class="line">556</span><br><span class="line">557</span><br><span class="line">558</span><br><span class="line">559</span><br><span class="line">560</span><br><span class="line">561</span><br><span class="line">562</span><br><span class="line">563</span><br><span class="line">564</span><br><span class="line">565</span><br><span class="line">566</span><br><span class="line">567</span><br><span class="line">568</span><br><span class="line">569</span><br><span class="line">570</span><br><span class="line">571</span><br><span class="line">572</span><br><span class="line">573</span><br><span class="line">574</span><br><span class="line">575</span><br><span class="line">576</span><br><span class="line">577</span><br><span class="line">578</span><br><span class="line">579</span><br><span class="line">580</span><br><span class="line">581</span><br><span class="line">582</span><br><span class="line">583</span><br><span class="line">584</span><br><span class="line">585</span><br><span class="line">586</span><br><span class="line">587</span><br><span class="line">588</span><br><span class="line">589</span><br><span class="line">590</span><br><span class="line">591</span><br><span class="line">592</span><br><span class="line">593</span><br><span class="line">594</span><br><span class="line">595</span><br><span class="line">596</span><br><span class="line">597</span><br><span class="line">598</span><br><span class="line">599</span><br><span class="line">600</span><br><span class="line">601</span><br><span class="line">602</span><br><span class="line">603</span><br><span class="line">604</span><br><span class="line">605</span><br><span class="line">606</span><br><span class="line">607</span><br><span class="line">608</span><br><span class="line">609</span><br><span class="line">610</span><br><span class="line">611</span><br><span class="line">612</span><br><span class="line">613</span><br><span class="line">614</span><br><span class="line">615</span><br><span class="line">616</span><br><span class="line">617</span><br><span class="line">618</span><br><span class="line">619</span><br><span class="line">620</span><br><span class="line">621</span><br><span class="line">622</span><br><span class="line">623</span><br><span class="line">624</span><br><span class="line">625</span><br><span class="line">626</span><br><span class="line">627</span><br><span class="line">628</span><br><span class="line">629</span><br><span class="line">630</span><br><span class="line">631</span><br><span class="line">632</span><br><span class="line">633</span><br><span class="line">634</span><br><span class="line">635</span><br><span class="line">636</span><br><span class="line">637</span><br><span class="line">638</span><br><span class="line">639</span><br><span class="line">640</span><br><span class="line">641</span><br><span class="line">642</span><br><span class="line">643</span><br><span class="line">644</span><br><span class="line">645</span><br><span class="line">646</span><br><span class="line">647</span><br><span class="line">648</span><br><span class="line">649</span><br><span class="line">650</span><br><span class="line">651</span><br><span class="line">652</span><br><span class="line">653</span><br><span class="line">654</span><br><span class="line">655</span><br><span class="line">656</span><br><span class="line">657</span><br><span class="line">658</span><br><span class="line">659</span><br><span class="line">660</span><br><span class="line">661</span><br><span class="line">662</span><br><span class="line">663</span><br><span class="line">664</span><br><span class="line">665</span><br><span class="line">666</span><br><span class="line">667</span><br><span class="line">668</span><br><span class="line">669</span><br><span class="line">670</span><br><span class="line">671</span><br><span class="line">672</span><br><span class="line">673</span><br><span class="line">674</span><br><span class="line">675</span><br><span class="line">676</span><br><span class="line">677</span><br><span class="line">678</span><br><span class="line">679</span><br><span class="line">680</span><br><span class="line">681</span><br><span class="line">682</span><br><span class="line">683</span><br><span class="line">684</span><br><span class="line">685</span><br><span class="line">686</span><br><span class="line">687</span><br><span class="line">688</span><br><span class="line">689</span><br><span class="line">690</span><br><span class="line">691</span><br><span class="line">692</span><br><span class="line">693</span><br><span class="line">694</span><br><span class="line">695</span><br><span class="line">696</span><br><span class="line">697</span><br><span class="line">698</span><br><span class="line">699</span><br><span class="line">700</span><br><span class="line">701</span><br><span class="line">702</span><br><span class="line">703</span><br><span class="line">704</span><br><span class="line">705</span><br><span class="line">706</span><br><span class="line">707</span><br><span class="line">708</span><br><span class="line">709</span><br><span class="line">710</span><br><span class="line">711</span><br><span class="line">712</span><br><span class="line">713</span><br><span class="line">714</span><br><span class="line">715</span><br><span class="line">716</span><br><span class="line">717</span><br><span class="line">718</span><br><span class="line">719</span><br><span class="line">720</span><br><span class="line">721</span><br><span class="line">722</span><br><span class="line">723</span><br><span class="line">724</span><br><span class="line">725</span><br><span class="line">726</span><br><span class="line">727</span><br><span class="line">728</span><br><span class="line">729</span><br><span class="line">730</span><br><span class="line">731</span><br><span class="line">732</span><br><span class="line">733</span><br><span class="line">734</span><br><span class="line">735</span><br><span class="line">736</span><br><span class="line">737</span><br><span class="line">738</span><br><span class="line">739</span><br><span class="line">740</span><br><span class="line">741</span><br><span class="line">742</span><br><span class="line">743</span><br><span class="line">744</span><br><span class="line">745</span><br><span class="line">746</span><br><span class="line">747</span><br><span class="line">748</span><br><span class="line">749</span><br><span class="line">750</span><br><span class="line">751</span><br><span class="line">752</span><br><span class="line">753</span><br><span class="line">754</span><br><span class="line">755</span><br><span class="line">756</span><br><span class="line">757</span><br><span class="line">758</span><br><span class="line">759</span><br><span class="line">760</span><br><span class="line">761</span><br><span class="line">762</span><br><span class="line">763</span><br><span class="line">764</span><br><span class="line">765</span><br><span class="line">766</span><br><span class="line">767</span><br><span class="line">768</span><br><span class="line">769</span><br><span class="line">770</span><br><span class="line">771</span><br><span class="line">772</span><br><span class="line">773</span><br><span class="line">774</span><br><span class="line">775</span><br><span class="line">776</span><br><span class="line">777</span><br><span class="line">778</span><br><span class="line">779</span><br><span class="line">780</span><br><span class="line">781</span><br><span class="line">782</span><br><span class="line">783</span><br><span class="line">784</span><br><span class="line">785</span><br><span class="line">786</span><br><span class="line">787</span><br><span class="line">788</span><br><span class="line">789</span><br><span class="line">790</span><br><span class="line">791</span><br><span class="line">792</span><br><span class="line">793</span><br><span class="line">794</span><br><span class="line">795</span><br><span class="line">796</span><br><span class="line">797</span><br><span class="line">798</span><br><span class="line">799</span><br><span class="line">800</span><br><span class="line">801</span><br><span class="line">802</span><br><span class="line">803</span><br><span class="line">804</span><br><span class="line">805</span><br><span class="line">806</span><br><span class="line">807</span><br><span class="line">808</span><br><span class="line">809</span><br><span class="line">810</span><br><span class="line">811</span><br><span class="line">812</span><br><span class="line">813</span><br><span class="line">814</span><br><span class="line">815</span><br><span class="line">816</span><br><span class="line">817</span><br><span class="line">818</span><br><span class="line">819</span><br><span class="line">820</span><br><span class="line">821</span><br><span class="line">822</span><br><span class="line">823</span><br><span class="line">824</span><br><span class="line">825</span><br><span class="line">826</span><br><span class="line">827</span><br><span class="line">828</span><br><span class="line">829</span><br><span class="line">830</span><br><span class="line">831</span><br><span class="line">832</span><br><span class="line">833</span><br><span class="line">834</span><br><span class="line">835</span><br></pre></td><td class="code"><pre><span class="line">#include&lt;stdio.h&gt;</span><br><span class="line">#include&lt;string.h&gt;</span><br><span class="line">#include&lt;stdlib.h&gt;</span><br><span class="line">#include&lt;windows.h&gt;</span><br><span class="line">#include&lt;conio.h&gt;</span><br><span class="line">#include&lt;time.h&gt;</span><br><span class="line">#define OK 1;</span><br><span class="line">#define ERROR 0;</span><br><span class="line">#define NO -1;</span><br><span class="line">void login_menu();//登陆界面</span><br><span class="line">void main_menu();//账号登陆后界面 </span><br><span class="line">void book_manage_menu();//图书管理界面</span><br><span class="line">void book_borrow_menu();//借阅相关 </span><br><span class="line">void createuser();//创建账户</span><br><span class="line">void login_menu1();//登陆菜单的函数 </span><br><span class="line">void landuser();//账户登陆 </span><br><span class="line">void changepassword();//修改密码</span><br><span class="line">void change(int user, char password[20]);//修改密码的操作 </span><br><span class="line">int match(int user, char password[20]);//匹配数据库中的账号密码</span><br><span class="line">void addbook();//增加图书 </span><br><span class="line">void deletebook();//删除图书</span><br><span class="line">void book_look();//查看库存</span><br><span class="line">void book_chaxun();//查询图书 </span><br><span class="line">void book_lend();//借书登记 </span><br><span class="line">void lendinformation();//借阅信息 </span><br><span class="line">void today();//今日日期 </span><br><span class="line">void returnbook();//还书登记 </span><br><span class="line"></span><br><span class="line">int month,year,day;</span><br><span class="line">struct book//书籍信息 </span><br><span class="line">&#123;</span><br><span class="line">	char name[20];</span><br><span class="line">	char author[20];</span><br><span class="line">	char kind[20];</span><br><span class="line">	int number;</span><br><span class="line">	char id[20];	</span><br><span class="line">	struct book *next;</span><br><span class="line">&#125;;</span><br><span class="line">struct reader&#123;//借书登记信息 </span><br><span class="line">	char readername[20];</span><br><span class="line">	char readerid[20];</span><br><span class="line">	char bookname[20];</span><br><span class="line">	char bookauthor[20];</span><br><span class="line">	int year,month,day;</span><br><span class="line">	struct reader *next;</span><br><span class="line">&#125;;</span><br><span class="line">typedef struct book* Listb;</span><br><span class="line">typedef struct reader* Listr;</span><br><span class="line">int main()</span><br><span class="line">&#123;</span><br><span class="line">	today();</span><br><span class="line">	login_menu1();</span><br><span class="line">	return 0;</span><br><span class="line">&#125;</span><br><span class="line">void today()</span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	struct tm *p;</span><br><span class="line">	time_t t;</span><br><span class="line">	</span><br><span class="line">	time(&amp;t);</span><br><span class="line">	p=localtime(&amp;t);</span><br><span class="line">	//写入当前日期进文档</span><br><span class="line">	if((fp=fopen(&quot;date.txt&quot;,&quot;w&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;打开文件失败\n&quot;);</span><br><span class="line">		exit(0);	</span><br><span class="line">	&#125; </span><br><span class="line">	</span><br><span class="line">	fprintf(fp,&quot;%d-%d-%d&quot;,1900+p-&gt;tm_year,1+p-&gt;tm_mon,p-&gt;tm_mday);</span><br><span class="line">	fclose(fp);</span><br><span class="line">	</span><br><span class="line">	if((fp=fopen(&quot;date.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;打开文件失败\n&quot;);</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;</span><br><span class="line">	fscanf(fp,&quot;%d-%d-%d&quot;,&amp;year,&amp;month,&amp;day);</span><br><span class="line">	fclose(fp);</span><br><span class="line">&#125;</span><br><span class="line">void login_menu()//登陆界面</span><br><span class="line">&#123;</span><br><span class="line">	printf(&quot;今日日期:%d-%d-%d\n&quot;,year,month,day); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|    欢迎使用图书管理系统      |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         1.账号登陆           |\n&quot;); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         2.账号创建           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         3.退出系统           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">&#125;</span><br><span class="line">void createuser()//创建账户</span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	int user, reuser;</span><br><span class="line">	char password[20],password1[20],repassword[20];</span><br><span class="line">	char flag=0;</span><br><span class="line">	if ((fp = fopen(&quot;user.txt&quot;,&quot;r&quot;))==NULL)//打开txt文件，没有则创建 </span><br><span class="line">	&#123;</span><br><span class="line">		fp = fopen(&quot;user.txt&quot;,&quot;w&quot;);</span><br><span class="line">		fclose(fp);</span><br><span class="line">	&#125;</span><br><span class="line">	fp=fopen(&quot;user.txt&quot;,&quot;a+&quot;);</span><br><span class="line">	while(1)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;\n账号为纯数字,密码长度上限为20\n&quot;);</span><br><span class="line">		printf(&quot;请按以下格式输入账户:\n账号 密码\n&quot;);</span><br><span class="line">		printf(&quot;请输入:&quot;);</span><br><span class="line">		scanf(&quot;%d %s&quot;,&amp;user,password);</span><br><span class="line">		getchar();</span><br><span class="line">		printf(&quot;请再次输入密码:\n&quot;);</span><br><span class="line">		scanf(&quot;%s&quot;,password1);</span><br><span class="line">		getchar();</span><br><span class="line">		if(strcmp(password,password1)==0)</span><br><span class="line">		&#123;</span><br><span class="line">			while (fscanf(fp, &quot;%d %s&quot;, &amp;reuser, repassword) == 2)</span><br><span class="line">			&#123;</span><br><span class="line">				if (reuser == user)</span><br><span class="line">				&#123;</span><br><span class="line">					printf(&quot;学号已存在\n&quot;);</span><br><span class="line">					Sleep(2000);</span><br><span class="line">					fclose(fp);</span><br><span class="line">					system(&quot;cls&quot;);</span><br><span class="line">					login_menu1();</span><br><span class="line">				&#125;</span><br><span class="line">			&#125;</span><br><span class="line">			fprintf(fp,&quot;%d %s\n&quot;,user,password);</span><br><span class="line">			fclose(fp);</span><br><span class="line">			printf(&quot;创建成功\n&quot;);</span><br><span class="line">			Sleep(2000); </span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			login_menu1(); </span><br><span class="line">		&#125;</span><br><span class="line">		else</span><br><span class="line">		&#123;</span><br><span class="line">			printf(&quot;两次输入密码不一样\n&quot;);</span><br><span class="line">			Sleep(2000);</span><br><span class="line">			fclose(fp);</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			login_menu1();</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125; </span><br><span class="line">void login_menu1()//登陆菜单的函数 </span><br><span class="line">&#123;</span><br><span class="line">	char choose;</span><br><span class="line">	login_menu();</span><br><span class="line">	printf(&quot;请输入对应数字:\n&quot;);</span><br><span class="line">	scanf(&quot;%c&quot;,&amp;choose);</span><br><span class="line">	getchar();</span><br><span class="line">	switch(choose)</span><br><span class="line">	&#123;</span><br><span class="line">		case&#x27;1&#x27;:</span><br><span class="line">			landuser();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;2&#x27;:</span><br><span class="line">		  	createuser();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;3&#x27;:</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			printf(&quot;退出成功&quot;);</span><br><span class="line">			exit(0);</span><br><span class="line">			break;</span><br><span class="line">		default:</span><br><span class="line">			printf(&quot;无效输入\n&quot;);</span><br><span class="line">			Sleep(2000);</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			login_menu1();</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">&#125;</span><br><span class="line">void landuser()//账户登陆</span><br><span class="line">&#123;</span><br><span class="line">	int user;</span><br><span class="line">	int flag;</span><br><span class="line">	char password[20];</span><br><span class="line">	printf(&quot;请输入账户:\n&quot;);</span><br><span class="line">	scanf(&quot;%d&quot;,&amp;user);</span><br><span class="line">	getchar();</span><br><span class="line">	printf(&quot;请输入密码:\n&quot;);</span><br><span class="line">	scanf(&quot;%s&quot;,password);</span><br><span class="line">	getchar();</span><br><span class="line">	flag=match(user,password);//判定返回内容</span><br><span class="line">	if(flag==1) </span><br><span class="line">	&#123;</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		printf(&quot;登陆成功\n&quot;);</span><br><span class="line">		Sleep(2000);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		main_menu();</span><br><span class="line">	&#125;</span><br><span class="line">	else if(flag==0)</span><br><span class="line">	&#123;</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		printf(&quot;密码错误\n&quot;);	</span><br><span class="line">		Sleep(2000);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		login_menu1();</span><br><span class="line">	&#125;</span><br><span class="line">	else if(flag==-1)</span><br><span class="line">	&#123;</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		printf(&quot;账户错误\n&quot;);</span><br><span class="line">		Sleep(2000);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		login_menu1();</span><br><span class="line">	&#125;</span><br><span class="line">&#125; </span><br><span class="line">int match(int user, char password[20])//匹配数据库中的账号密码</span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	int localuser;</span><br><span class="line">	char localpassword[20];</span><br><span class="line">	if((fp=fopen(&quot;user.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;还未存在用户\n&quot;);</span><br><span class="line">		Sleep(2000);</span><br><span class="line">		system(&quot;cls&quot;); </span><br><span class="line">		login_menu1();</span><br><span class="line">	&#125;</span><br><span class="line">	while(1)</span><br><span class="line">	&#123;</span><br><span class="line">		fscanf(fp,&quot;%d %s&quot;,&amp;localuser,localpassword);</span><br><span class="line">		if(feof(fp))</span><br><span class="line">		&#123;</span><br><span class="line">			break;</span><br><span class="line">		&#125;</span><br><span class="line">		if(user==localuser)</span><br><span class="line">		&#123;</span><br><span class="line">			if(strcmp(localpassword,password)==0)</span><br><span class="line">			&#123;</span><br><span class="line">				return OK;</span><br><span class="line">			&#125;</span><br><span class="line">			else</span><br><span class="line">			&#123;</span><br><span class="line">				return ERROR;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	return NO;</span><br><span class="line">&#125;</span><br><span class="line">void main_menu()//账号登陆后界面 </span><br><span class="line">&#123;</span><br><span class="line">	char choose;</span><br><span class="line">	printf(&quot;今日日期:%d-%d-%d\n&quot;,year,month,day); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|    欢迎使用图书管理系统      |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         1.图书管理           |\n&quot;); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         2.借阅相关           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         3.退出系统           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;); </span><br><span class="line">	printf(&quot;请输入序号选择:&quot;); </span><br><span class="line">	scanf(&quot;%c&quot;,&amp;choose);</span><br><span class="line">	getchar();</span><br><span class="line">	switch(choose)</span><br><span class="line">	&#123;</span><br><span class="line">		case&#x27;1&#x27;:</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			book_manage_menu();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;2&#x27;:</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			book_borrow_menu();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;3&#x27;:</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			printf(&quot;退出成功&quot;);</span><br><span class="line">			exit(0);</span><br><span class="line">			break;</span><br><span class="line">		default:</span><br><span class="line">			printf(&quot;无效输入\n&quot;);</span><br><span class="line">			Sleep(2000);</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			main_menu();	</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line">void book_manage_menu()//图书管理界面</span><br><span class="line">&#123;</span><br><span class="line">	char choose;</span><br><span class="line">	printf(&quot;今日日期:%d-%d-%d\n&quot;,year,month,day); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|    欢迎使用图书管理系统      |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         1.增加图书           |\n&quot;); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         2.删除图书           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         3.查看库存           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         4.查询图书           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         5.返回上一级         |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;请输入选择:&quot;); </span><br><span class="line">	scanf(&quot;%c&quot;,&amp;choose);</span><br><span class="line">	getchar();</span><br><span class="line">	switch(choose)</span><br><span class="line">	&#123;</span><br><span class="line">		case&#x27;1&#x27;:</span><br><span class="line">			addbook();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;2&#x27;:</span><br><span class="line">			deletebook();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;3&#x27;:</span><br><span class="line">			book_look();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;4&#x27;: </span><br><span class="line">			book_chaxun();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;5&#x27;:</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			main_menu();</span><br><span class="line">			break;</span><br><span class="line">		default:</span><br><span class="line">			printf(&quot;无效输入\n&quot;);</span><br><span class="line">			Sleep(2000);</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			book_manage_menu();</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line">void addbook()</span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	char name[20],author[20],kind[20],id[20];</span><br><span class="line">	char reid[20]; </span><br><span class="line">	int number;</span><br><span class="line">	int flag=0,flag1=0,flag2=1;</span><br><span class="line">	</span><br><span class="line">	if((fp=fopen(&quot;bookinformation.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		fp=fopen(&quot;bookinformation.txt&quot;,&quot;w&quot;);</span><br><span class="line">		fclose(fp); </span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	do</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;请按照 (书名 作者 种类 编号 数量) 的格式输入:\n&quot;);</span><br><span class="line">		flag=scanf(&quot;%s %s %s %s %d&quot;,name,author,kind,id,&amp;number);</span><br><span class="line">		getchar();</span><br><span class="line">	&#125;while(flag!=5&amp;&amp;printf(&quot;输入错误\n&quot;));</span><br><span class="line">	fp=fopen(&quot;bookinformation.txt&quot;,&quot;r&quot;);</span><br><span class="line">	while(1)</span><br><span class="line">	&#123;</span><br><span class="line">		fscanf(fp,&quot;%s&quot;,reid);</span><br><span class="line">		if(feof(fp))</span><br><span class="line">		&#123;</span><br><span class="line">			break;</span><br><span class="line">		&#125;</span><br><span class="line">		if(strcmp(reid,id)==0)</span><br><span class="line">		&#123;</span><br><span class="line">			flag2=0;</span><br><span class="line">			break;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp);</span><br><span class="line">	if(flag2==1)</span><br><span class="line">	&#123;</span><br><span class="line">		fp=fopen(&quot;bookinformation.txt&quot;,&quot;a+&quot;);</span><br><span class="line">		flag1=fprintf(fp,&quot;%s %s %s %s %d\n&quot;,name,author,kind,id,number);</span><br><span class="line">		if(flag1&gt;0)</span><br><span class="line">		&#123;</span><br><span class="line">			printf(&quot;添加成功\n&quot;);</span><br><span class="line">		&#125;</span><br><span class="line">		else</span><br><span class="line">		&#123;</span><br><span class="line">			printf(&quot;请重试\n&quot;);	</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	else</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;编号重复！\n&quot;);</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp);</span><br><span class="line">	Sleep(2000);</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	book_manage_menu();</span><br><span class="line">&#125;</span><br><span class="line">void deletebook()//删除图书</span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	char name[20],author[20],kind[20],id[20];</span><br><span class="line">	int number;</span><br><span class="line">	char reid[20];</span><br><span class="line">	int flag=0;</span><br><span class="line">	Listb head,tail,pt;</span><br><span class="line">	head=tail=pt=NULL;</span><br><span class="line">	if((fp=fopen(&quot;bookinformation.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;文件不存在\n&quot;);</span><br><span class="line">		Sleep(2000);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_manage_menu();</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;</span><br><span class="line">	else</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;请输入需要删除的图书编号:\n&quot;);</span><br><span class="line">		scanf(&quot;%s&quot;,reid);</span><br><span class="line">		getchar();</span><br><span class="line">		while((fscanf(fp,&quot;%s %s %s %s %d&quot;,name,author,kind,id,&amp;number))==5)</span><br><span class="line">		&#123;</span><br><span class="line">			if(strcmp(id,reid))</span><br><span class="line">			&#123;</span><br><span class="line">				pt=(Listb)malloc(sizeof(struct book));</span><br><span class="line">				strcpy(pt-&gt;name,name);</span><br><span class="line">				strcpy(pt-&gt;author,author);</span><br><span class="line">				strcpy(pt-&gt;kind,kind);</span><br><span class="line">				strcpy(pt-&gt;id,id);</span><br><span class="line">				pt-&gt;number=number;</span><br><span class="line">				pt-&gt;next=NULL;</span><br><span class="line">				if(head==NULL)</span><br><span class="line">				&#123;</span><br><span class="line">					head=pt;</span><br><span class="line">				&#125;</span><br><span class="line">				else</span><br><span class="line">				&#123;</span><br><span class="line">					tail-&gt;next=pt;	</span><br><span class="line">				&#125; </span><br><span class="line">				tail=pt;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp);</span><br><span class="line">	fp=fopen(&quot;bookinformation.txt&quot;,&quot;w&quot;);</span><br><span class="line">	fclose(fp);</span><br><span class="line">	fp=fopen(&quot;bookinformation.txt&quot;,&quot;a+&quot;);</span><br><span class="line">	pt=head;</span><br><span class="line">	while(pt)</span><br><span class="line">	&#123;</span><br><span class="line">		fprintf(fp,&quot;%s %s %s %s %d\n&quot;,pt-&gt;name,pt-&gt;author,pt-&gt;kind,pt-&gt;id,pt-&gt;number);</span><br><span class="line">		pt=pt-&gt;next;</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp);</span><br><span class="line">	printf(&quot;删除成功\n&quot;); </span><br><span class="line">	Sleep(2000);</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	book_manage_menu();</span><br><span class="line">	exit(0); </span><br><span class="line">&#125; </span><br><span class="line">void book_look()//查看库存</span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	char name[20],author[20],kind[20],id[20];</span><br><span class="line">	int number;</span><br><span class="line">	int flag=1,flag1=0;</span><br><span class="line">	</span><br><span class="line">	if((fp=fopen(&quot;bookinformation.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;文件不存在\n&quot;);</span><br><span class="line">		Sleep(200);	</span><br><span class="line">		book_manage_menu();</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;	</span><br><span class="line">	while(1)</span><br><span class="line">	&#123;</span><br><span class="line">		flag1=fscanf(fp,&quot;%s %s %s %s %d&quot;,name,author,kind,id,&amp;number);</span><br><span class="line">		if(flag1!=5)</span><br><span class="line">		&#123;</span><br><span class="line">			break;</span><br><span class="line">		&#125;</span><br><span class="line">		if(flag)</span><br><span class="line">		&#123;</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			printf(&quot;库存:\n&quot;);</span><br><span class="line">			printf(&quot;书名\t\t\t作者\t\t\t种类\t\t\t编号\t\t\t数量\n&quot;);</span><br><span class="line">		&#125;</span><br><span class="line">		printf(&quot;%-24s%-24s%-24s%-24s%-23d\n&quot;,name,author,kind,id,number);</span><br><span class="line">		flag=0;</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp);</span><br><span class="line">	if(flag)</span><br><span class="line">	&#123;</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		printf(&quot;当前没有库存\n&quot;);</span><br><span class="line">		system(&quot;pause&quot;);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_manage_menu();</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;</span><br><span class="line">	system(&quot;pause&quot;);</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	book_manage_menu();</span><br><span class="line">&#125;</span><br><span class="line">void book_chaxun()//查询图书 </span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	char name[20],author[20],kind[20],id[20];</span><br><span class="line">	int number;</span><br><span class="line">	int flag1=1,flag2=0;</span><br><span class="line">	char information[20];</span><br><span class="line">	</span><br><span class="line">	if((fp=fopen(&quot;bookinformation.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;文件不存在\n&quot;);</span><br><span class="line">		Sleep(2000);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_manage_menu();</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	printf(&quot;请输入书名，作者或者编号:\n&quot;);</span><br><span class="line">	scanf(&quot;%s&quot;,information);</span><br><span class="line">	getchar();</span><br><span class="line">	while(1)</span><br><span class="line">	&#123;</span><br><span class="line">		flag2=fscanf(fp,&quot;%s %s %s %s %d&quot;,name,author,kind,id,&amp;number);</span><br><span class="line">		if(flag2!=5)</span><br><span class="line">		&#123;</span><br><span class="line">			break;</span><br><span class="line">		&#125;</span><br><span class="line">		if((strstr(name,information))||(strcmp(author,information)==0)||(strcmp(id,information)==0))</span><br><span class="line">		&#123;</span><br><span class="line">			if(flag1)</span><br><span class="line">			&#123;</span><br><span class="line">				printf(&quot;查询结果如下:\n&quot;);</span><br><span class="line">				printf(&quot;书名\t\t\t作者\t\t\t种类\t\t\t编号\t\t\t数量\n&quot;);</span><br><span class="line">			&#125;	</span><br><span class="line">			printf(&quot;%-24s%-24s%-24s%-24s%-23d&quot;,name,author,kind,id,number);</span><br><span class="line">			flag1=0;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp);</span><br><span class="line">	if(flag1!=0)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;未查询到相关书籍!&quot;);</span><br><span class="line">		system(&quot;pause&quot;);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_manage_menu();</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;</span><br><span class="line">	system(&quot;pause&quot;);</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	book_manage_menu();</span><br><span class="line">&#125;</span><br><span class="line">void book_borrow_menu()</span><br><span class="line">&#123;</span><br><span class="line">	char choose;</span><br><span class="line">	printf(&quot;今日日期:%d-%d-%d\n&quot;,year,month,day); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|    欢迎使用图书管理系统      |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         1.借阅登记           |\n&quot;); </span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         2.还书登记           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         3.借阅信息           |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;|         4.返回上一级         |\n&quot;);</span><br><span class="line">	printf(&quot;-------------------------------\n&quot;);</span><br><span class="line">	printf(&quot;请输入选择:&quot;);</span><br><span class="line">	scanf(&quot;%c&quot;,&amp;choose);</span><br><span class="line">	getchar();</span><br><span class="line">	switch(choose)</span><br><span class="line">	&#123;</span><br><span class="line">		case&#x27;1&#x27;:</span><br><span class="line">			book_lend();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;2&#x27;:</span><br><span class="line">			returnbook();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;3&#x27;:</span><br><span class="line">			lendinformation();</span><br><span class="line">			break;</span><br><span class="line">		case&#x27;4&#x27;:</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			main_menu();</span><br><span class="line">			break;</span><br><span class="line">		default:</span><br><span class="line">			printf(&quot;无效输入\n&quot;);</span><br><span class="line">			Sleep(2000);</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			book_borrow_menu();</span><br><span class="line">			break;</span><br><span class="line">	&#125;</span><br><span class="line">&#125; </span><br><span class="line">void book_lend()//借书登记</span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp,*fp2;//fp2为读者信息 </span><br><span class="line">	char name[20],author[20],kind[20],id[20];</span><br><span class="line">	char lendname[20],lendauthor[20];</span><br><span class="line">	char readname[20],readid[20];</span><br><span class="line">	int number;</span><br><span class="line">	int flag=0,num;</span><br><span class="line">	Listb pt = NULL;</span><br><span class="line">	Listb tail = NULL;</span><br><span class="line">	Listb head = NULL;</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	if((fp=fopen(&quot;bookinformation.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;图书馆无库存!\n&quot;);</span><br><span class="line">		system(&quot;pause&quot;);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_borrow_menu();</span><br><span class="line">		exit(0);	</span><br><span class="line">	&#125; </span><br><span class="line">	else</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;请输入书名和作者:\n&quot;);</span><br><span class="line">		scanf(&quot;%s %s&quot;,lendname,lendauthor);</span><br><span class="line">		getchar();</span><br><span class="line">		while((fscanf(fp,&quot;%s %s %s %s %d&quot;,name,author,kind,id,&amp;number))==5)</span><br><span class="line">		&#123;</span><br><span class="line">			pt=(Listb)malloc(sizeof(struct book));</span><br><span class="line">			strcpy(pt-&gt;name,name);</span><br><span class="line">			strcpy(pt-&gt;author,author);</span><br><span class="line">			strcpy(pt-&gt;kind,kind);</span><br><span class="line">			pt-&gt;number=number;</span><br><span class="line">			strcpy(pt-&gt;id,id);</span><br><span class="line">			pt-&gt;next=NULL;</span><br><span class="line">			if (head==NULL)</span><br><span class="line">			&#123;</span><br><span class="line">				head=pt;</span><br><span class="line">			&#125;</span><br><span class="line">			else</span><br><span class="line">			&#123;</span><br><span class="line">				tail-&gt;next=pt;</span><br><span class="line">			&#125;</span><br><span class="line">			tail=pt;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp);</span><br><span class="line">	tail=head;</span><br><span class="line">	while(tail)</span><br><span class="line">	&#123;</span><br><span class="line">		if ((strcmp(tail-&gt;name,lendname)==0) &amp;&amp; (strcmp(tail-&gt;author, lendauthor)==0))//判断要借书的是否存在，标记等于1，存在库存减一</span><br><span class="line">		&#123;</span><br><span class="line"></span><br><span class="line">			flag=1;</span><br><span class="line">			num=tail-&gt;number;</span><br><span class="line">			(tail-&gt;number)--;</span><br><span class="line">		&#125;</span><br><span class="line">		tail=tail-&gt;next;</span><br><span class="line">	&#125;</span><br><span class="line">	if (flag&amp;&amp;(num&gt;0))//存在被借的图书且现存量大于0，把库存量变化后的链表存入文件</span><br><span class="line">	&#123;</span><br><span class="line"></span><br><span class="line">		fp=fopen(&quot;bookinformation.txt&quot;, &quot;w&quot;);</span><br><span class="line">		fclose(fp);</span><br><span class="line">		fp=fopen(&quot;bookinformation.txt&quot;, &quot;a&quot;);</span><br><span class="line">		tail=head;</span><br><span class="line"></span><br><span class="line">		while (tail!=NULL)</span><br><span class="line">		&#123;</span><br><span class="line">			fprintf(fp, &quot;%s %s %s %s %d \n&quot;,tail-&gt;name,tail-&gt;author,tail-&gt;kind,tail-&gt;id,tail-&gt;number);</span><br><span class="line">			tail=tail-&gt;next;</span><br><span class="line">		&#125;</span><br><span class="line">		fclose(fp);</span><br><span class="line">		if((fp2=fopen(&quot;reader.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">		&#123;</span><br><span class="line">			fp2=fopen(&quot;reader.txt&quot;,&quot;w&quot;);</span><br><span class="line">			fclose(fp2);</span><br><span class="line">		&#125;</span><br><span class="line">		fp2=fopen(&quot;reader.txt&quot;,&quot;a&quot;);</span><br><span class="line">		printf(&quot;请按格式输入:\n姓名 学号\n&quot;);</span><br><span class="line">		scanf(&quot;%s %s&quot;,readname,readid);</span><br><span class="line">		getchar();</span><br><span class="line">		fprintf(fp2,&quot;%s %s %s %s %d-%d-%d\n&quot;,readname,readid,lendname,lendauthor,year,month,day);</span><br><span class="line">		fclose(fp2);</span><br><span class="line">		printf(&quot;借书成功！\n&quot;);</span><br><span class="line">		printf(&quot;借书日期:%d-%d-%d\n&quot;,year,month,day);</span><br><span class="line">		printf(&quot;请在两个月内归还!\n&quot;);</span><br><span class="line">		system(&quot;pause&quot;);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_borrow_menu();</span><br><span class="line">	&#125;</span><br><span class="line">	else</span><br><span class="line">	&#123;</span><br><span class="line">		if(flag!=0)</span><br><span class="line">		&#123;</span><br><span class="line">			printf(&quot;此书无存货!\n&quot;);</span><br><span class="line">		&#125;</span><br><span class="line">		else</span><br><span class="line">		&#123;</span><br><span class="line">			printf(&quot;查无此书！\n&quot;);</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	system(&quot;pause&quot;);</span><br><span class="line">	system(&quot;cls&quot;); </span><br><span class="line">	book_borrow_menu();</span><br><span class="line">&#125; </span><br><span class="line">void lendinformation()//借阅信息 </span><br><span class="line">&#123;</span><br><span class="line">	FILE *fp;</span><br><span class="line">	char lendname[20],lendauthor[20],name[20],id[20];</span><br><span class="line">	int YEAR,MONTH,DAY;</span><br><span class="line">	int flag=1;</span><br><span class="line">	if((fp=fopen(&quot;reader.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;记录文件不存在\n&quot;);</span><br><span class="line">		system(&quot;pause&quot;);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_borrow_menu();</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	printf(&quot;姓名\t\t\t学号\t\t\t书名\t\t\t作者\t\t\t日期\n&quot;);</span><br><span class="line">	while((fscanf(fp,&quot;%s %s %s %s %d-%d-%d&quot;,name,id,lendname,lendauthor,&amp;YEAR,&amp;MONTH,&amp;DAY))==7)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;%-23s%-23s%-23s%-23s%5d-%d-%d\n&quot;,name,id,lendname,lendauthor,YEAR,MONTH,DAY);</span><br><span class="line">		flag=0;	</span><br><span class="line">	&#125; </span><br><span class="line">	if(flag)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;暂无记录\n&quot;);</span><br><span class="line">	&#125;</span><br><span class="line">	system(&quot;pause&quot;);</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	book_borrow_menu();</span><br><span class="line">&#125;</span><br><span class="line">void returnbook()//还书登记</span><br><span class="line">&#123;</span><br><span class="line">	char name[20],author[20],kind[20],id[20];//书籍信息 </span><br><span class="line">	int number; </span><br><span class="line">	char readername[20],readerid[20],bookname[20],bookauthor[20];</span><br><span class="line">	int YEAR,MONTH,DAY;</span><br><span class="line">	FILE *fp1,*fp2;</span><br><span class="line">	Listr head1,tail1,pt1;</span><br><span class="line">	head1=tail1=pt1=NULL;</span><br><span class="line">	Listb head2,tail2,pt2;</span><br><span class="line">	head2=tail2=pt2=NULL; </span><br><span class="line">	char borrow_id[20],borrow_book[20];</span><br><span class="line">	int flag=0;</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	if((fp1=fopen(&quot;reader.txt&quot;,&quot;r&quot;))==NULL)</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;不存在借书文件!\n&quot;);</span><br><span class="line">		system(&quot;pause&quot;);</span><br><span class="line">		system(&quot;cls&quot;);</span><br><span class="line">		book_borrow_menu();</span><br><span class="line">		exit(0);</span><br><span class="line">	&#125;</span><br><span class="line">	else</span><br><span class="line">	&#123;</span><br><span class="line">		printf(&quot;请输入学号和书名\n&quot;);</span><br><span class="line">		scanf(&quot;%s %s&quot;,borrow_id,borrow_book);</span><br><span class="line">		getchar();</span><br><span class="line">		while((fscanf(fp1,&quot;%s %s %s %s %d-%d-%d&quot;,readername,readerid,bookname,bookauthor,&amp;YEAR,&amp;MONTH,&amp;DAY))==7)</span><br><span class="line">		&#123;</span><br><span class="line">			if((strcmp(borrow_id,readerid)==0)&amp;&amp;(strcmp(borrow_book,bookname)==0))</span><br><span class="line">			&#123;</span><br><span class="line">				flag=1;</span><br><span class="line">			&#125;</span><br><span class="line">			else</span><br><span class="line">			&#123;</span><br><span class="line">				pt1=(Listr)malloc(sizeof(struct reader));</span><br><span class="line">				strcpy(pt1-&gt;readername,readername);</span><br><span class="line">				strcpy(pt1-&gt;readerid,readerid);</span><br><span class="line">				strcpy(pt1-&gt;bookname,bookname);</span><br><span class="line">				strcpy(pt1-&gt;bookauthor,bookauthor);</span><br><span class="line">				pt1-&gt;year=YEAR;</span><br><span class="line">				pt1-&gt;month=MONTH;</span><br><span class="line">				pt1-&gt;day=DAY;</span><br><span class="line">				pt1-&gt;next=NULL;</span><br><span class="line">				if(head1==NULL)</span><br><span class="line">				&#123;</span><br><span class="line">					head1=pt1;</span><br><span class="line">				&#125;</span><br><span class="line">				else</span><br><span class="line">				&#123;</span><br><span class="line">					tail1-&gt;next=pt1;</span><br><span class="line">				&#125;</span><br><span class="line">				tail1=pt1;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">		if(flag!=1)</span><br><span class="line">		&#123;</span><br><span class="line">			printf(&quot;未找到借阅信息\n&quot;);</span><br><span class="line">			system(&quot;pause&quot;);</span><br><span class="line">			system(&quot;cls&quot;);</span><br><span class="line">			book_borrow_menu();</span><br><span class="line">			exit(0);</span><br><span class="line">		&#125;</span><br><span class="line">		fclose(fp1);</span><br><span class="line">	&#125;</span><br><span class="line">	fp1=fopen(&quot;reader.txt&quot;,&quot;w&quot;);//清空</span><br><span class="line">	fclose(fp1);</span><br><span class="line">	fp1=fopen(&quot;reader.txt&quot;,&quot;a&quot;);//重新写入</span><br><span class="line">	tail1=head1;</span><br><span class="line">	while(tail1)</span><br><span class="line">	&#123;</span><br><span class="line">		fprintf(fp1,&quot;%s %s %s %s %d-%d-%d\n&quot;,tail1-&gt;readername,tail1-&gt;readerid,tail1-&gt;bookname,tail1-&gt;bookauthor,tail1-&gt;year,tail1-&gt;month,tail1-&gt;day);</span><br><span class="line">		tail1=tail1-&gt;next;		</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp1);</span><br><span class="line">	fp2=fopen(&quot;bookinformation.txt&quot;,&quot;r&quot;);</span><br><span class="line">	while((fscanf(fp2,&quot;%s %s %s %s %d&quot;,name,author,kind,id,&amp;number))==5) </span><br><span class="line">	&#123;</span><br><span class="line">		pt2=(Listb)malloc(sizeof(struct book));</span><br><span class="line">		strcpy(pt2-&gt;name,name);</span><br><span class="line">		strcpy(pt2-&gt;author,author);</span><br><span class="line">		strcpy(pt2-&gt;kind,kind);</span><br><span class="line">		strcpy(pt2-&gt;id,id);</span><br><span class="line">		pt2-&gt;number=number;</span><br><span class="line">		pt2-&gt;next=NULL;</span><br><span class="line">		if(head2==NULL)</span><br><span class="line">		&#123;</span><br><span class="line">			head2=pt2;</span><br><span class="line">		&#125;</span><br><span class="line">		else</span><br><span class="line">		&#123;</span><br><span class="line">			tail2-&gt;next=pt2;</span><br><span class="line">		&#125;</span><br><span class="line">		tail2=pt2;</span><br><span class="line">	&#125;</span><br><span class="line">	tail2=head2;</span><br><span class="line">	while(tail2)</span><br><span class="line">	&#123;</span><br><span class="line">		if((strcmp(tail2-&gt;name,bookname)==0))</span><br><span class="line">		&#123;</span><br><span class="line">			(tail2-&gt;number)++;</span><br><span class="line">		&#125;</span><br><span class="line">		tail2=tail2-&gt;next;</span><br><span class="line">	&#125;</span><br><span class="line">	fp2=fopen(&quot;bookinformation.txt&quot;,&quot;w&quot;);</span><br><span class="line">	fclose(fp2);</span><br><span class="line">	fp2=fopen(&quot;bookinformation.txt&quot;,&quot;a&quot;);</span><br><span class="line">	tail2=head2;</span><br><span class="line">	while(tail2)</span><br><span class="line">	&#123;</span><br><span class="line">		fprintf(fp2,&quot;%s %s %s %s %d\n&quot;,tail2-&gt;name,tail2-&gt;author,tail2-&gt;kind,tail2-&gt;id,tail2-&gt;number);</span><br><span class="line">		tail2=tail2-&gt;next;</span><br><span class="line">	&#125;</span><br><span class="line">	fclose(fp2);</span><br><span class="line">	printf(&quot;还书成功!\n&quot;);</span><br><span class="line">	system(&quot;pause&quot;);</span><br><span class="line">	system(&quot;cls&quot;);</span><br><span class="line">	book_borrow_menu();</span><br><span class="line">	exit(0);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">heit0ng</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://heit0ng.gitee.io/2022/05/16/C%E8%AF%AD%E8%A8%80%E5%9B%BE%E4%B9%A6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/">https://heit0ng.gitee.io/2022/05/16/C%E8%AF%AD%E8%A8%80%E5%9B%BE%E4%B9%A6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://heit0ng.gitee.io" target="_blank">heit0ng</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://s2.loli.net/2022/05/16/ae4E7n2D3I5mqkh.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/03/22/j2ee(1)/"><img class="prev-cover" src="https://s2.loli.net/2023/03/22/3KqCOLtHBdvhMFe.webp" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">j2ee(1)</div></div></a></div><div class="next-post pull-right"><a href="/2022/04/07/C++qt/"><img class="next-cover" src="https://s2.loli.net/2022/04/07/Cyg9WQLqSNxX7Av.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">C++Qt</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://s2.loli.net/2022/01/28/RkXzVpjubg3yGEI.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">heit0ng</div><div class="author-info__description"></div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">11</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/03/22/j2ee(2)/" title="j2ee(2)"><img src="https://s2.loli.net/2023/03/23/mTDuOeL67MFtgZs.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="j2ee(2)"/></a><div class="content"><a class="title" href="/2023/03/22/j2ee(2)/" title="j2ee(2)">j2ee(2)</a><time datetime="2023-03-22T15:50:01.860Z" title="发表于 2023-03-22 23:50:01">2023-03-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/03/22/j2ee(1)/" title="j2ee(1)"><img src="https://s2.loli.net/2023/03/22/3KqCOLtHBdvhMFe.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="j2ee(1)"/></a><div class="content"><a class="title" href="/2023/03/22/j2ee(1)/" title="j2ee(1)">j2ee(1)</a><time datetime="2023-03-22T12:20:17.683Z" title="发表于 2023-03-22 20:20:17">2023-03-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/05/16/C%E8%AF%AD%E8%A8%80%E5%9B%BE%E4%B9%A6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/" title="C语言图书管理系统"><img src="https://s2.loli.net/2022/05/16/ae4E7n2D3I5mqkh.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="C语言图书管理系统"/></a><div class="content"><a class="title" href="/2022/05/16/C%E8%AF%AD%E8%A8%80%E5%9B%BE%E4%B9%A6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/" title="C语言图书管理系统">C语言图书管理系统</a><time datetime="2022-05-16T14:28:31.730Z" title="发表于 2022-05-16 22:28:31">2022-05-16</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/04/07/C++qt/" title="C++Qt"><img src="https://s2.loli.net/2022/04/07/Cyg9WQLqSNxX7Av.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="C++Qt"/></a><div class="content"><a class="title" href="/2022/04/07/C++qt/" title="C++Qt">C++Qt</a><time datetime="2022-04-07T12:41:19.618Z" title="发表于 2022-04-07 20:41:19">2022-04-07</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/03/12/c++%E7%9A%84%E7%9F%A5%E8%AF%86(1)/" title="c++的知识(1)"><img src="https://s2.loli.net/2022/03/12/QrwRKYfGEmP3vVL.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="c++的知识(1)"/></a><div class="content"><a class="title" href="/2022/03/12/c++%E7%9A%84%E7%9F%A5%E8%AF%86(1)/" title="c++的知识(1)">c++的知识(1)</a><time datetime="2022-03-12T13:48:26.310Z" title="发表于 2022-03-12 21:48:26">2022-03-12</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By heit0ng</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>